<template>
  <PcHomePage v-if="IsPc"></PcHomePage>
  <WebHomePage v-else></WebHomePage>
</template>

<script>
import PcHomePage from '@/views/pc/homePage/index.vue'
import WebHomePage from '@/views/web/homePage/index.vue'
export default {
  name: 'homeIndex',
  components: {
    PcHomePage,
    WebHomePage
  },
  data() {
    return {
      IsPc: true
    }
  },
  beforeMount: function () {
    let windowWidth = window.innerWidth
    console.log(windowWidth)
    if (windowWidth > 800) {
      this.IsPc = true
    } else {
      this.IsPc = false
    }
  },
  mounted() {
    window.addEventListener('resize', this.init)
  },
  methods: {
    init() {
      let windowWidth = window.innerWidth
      console.log(windowWidth)
      if (windowWidth > 800) {
        this.IsPc = true
      } else {
        this.IsPc = false
      }
    }
  }
}
</script>
<style lang="scss" scoped></style>
